package com.lehecai.core.api.event;

import com.lehecai.core.api.AbstractApiResultBean;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class BatchPropInfo extends AbstractApiResultBean{
	
	public static final String QUERY_UID = "uid";
	
	public static final String SET_UID = "uid";
	public static final String SET_PROP_ID = "prop_id";
	public static final String SET_NUM = "num";
	public static final String SET_EXPIRATION = "expiration";

	private String uid;		       //编码
	private String prop_id;        //名称
	private String num;           //道具属性
	private String expiration;    //过期时间(小时)
	
	public static BatchPropInfo convertFromJSONObject(JSONObject object) {
		if (object == null) {
			return null;
		}
		BatchPropInfo batchPropInfo = new BatchPropInfo();
		batchPropInfo.setUid(object.getString(BatchPropInfo.SET_UID));
		batchPropInfo.setProp_id(object.getString(BatchPropInfo.SET_PROP_ID));
		batchPropInfo.setExpiration(object.getString(BatchPropInfo.SET_EXPIRATION));
		return batchPropInfo;
	}
	public static List<BatchPropInfo> convertFromJSONArray(JSONArray array) {
		if (array == null) {
			return null;
		}
		List<BatchPropInfo> list = new ArrayList<BatchPropInfo>();
		for (Iterator<?> iterator = array.iterator(); iterator.hasNext();) {
			JSONObject object = (JSONObject) iterator.next();
			list.add(convertFromJSONObject(object));
		}
		return list;
	}
	public String getUid() {
		return uid;
	}
	public void setUid(String uid) {
		this.uid = uid;
	}
	public String getProp_id() {
		return prop_id;
	}
	public void setProp_id(String prop_id) {
		this.prop_id = prop_id;
	}
	public String getNum() {
		return num;
	}
	public void setNum(String num) {
		this.num = num;
	}

	public String getExpiration() {
		return expiration;
	}

	public void setExpiration(String expiration) {
		this.expiration = expiration;
	}
}
